﻿using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class BgTheme : MonoBehaviour
{
    private SpriteRenderer m_SpriteRenderer;
    //繁琐 -改用容器
    //public Sprite[] sprites;
    private ManagerVars vars;

    private void Awake()
    {
        vars = ManagerVars.GetManagerVars();
        m_SpriteRenderer = GetComponent<SpriteRenderer>();
        int runValue = Random.Range(0,vars.bgThemeSpriteList.Count);//长度为4的左闭右开的随机值 0-3
        m_SpriteRenderer.sprite = vars.bgThemeSpriteList[runValue];
    }
}
